﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using CTRLayer;
using GenericModels;

namespace WcfTicketsLibrary
{

    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "AllTheServices" in both code and config file together.
    public class AllTheServices : ICities, IPerson, IShow, IBooking, ISeat
    {
        private CTRCity ctrCity;
        private CTRShow ctrShow;
        private CTRBooking ctrBooking;
        private CTRPerson ctrPerson;
        private CTRSeat ctrSeat;


        public AllTheServices()
        {
            ctrCity = new CTRCity();
            ctrShow = new CTRShow();
            ctrBooking = new CTRBooking();
            ctrPerson = new CTRPerson();
            ctrSeat = new CTRSeat();
        }

        #region Person services
        public Customer GetCustomerByPhoneNo(string phoneNo)
        {
            return ctrPerson.GetCustomerByPhoneNo(phoneNo);
        }

        public Employee GetEmployeeById(int empId)
        {
            Employee emp = new Employee();

            return ctrPerson.GetEmployeeById(empId);
        }

        public bool AddBookingToCustomer(Customer cust, Booking booking)
        {
            return ctrPerson.AddBookingToCustomer(cust, booking);
        }
        #endregion

        #region City services
        public void AddCityToDB(int postalCode, string cityName)
        {
            ctrCity.AddCityToDB(postalCode, cityName);
        }

        public City RetrieveCity(int postalCode)
        {
            return ctrCity.RetrieveCity(postalCode);

        }

        public List<City> RetrieveAllTheCities()
        {
            return ctrCity.RetrieveAllTheCities();
        }
        #endregion

        #region Booking services
        public Booking GetBookingById(int id)
        {
            return ctrBooking.GetBookingById(id);
        }

        public Booking InsertBooking(Booking booking)
        {
            return ctrBooking.InsertBooking(booking);
        }

        public PartBooking InsertPartBooking(PartBooking part)
        {
            return ctrBooking.InsertPartBooking(part);
        }

        public bool DeletePartBooking(Booking booking, PartBooking part)
        {
            return ctrBooking.DeletePartBooking(booking, part);
        }

        public Booking CreateLocalBooking()
        {
            return ctrBooking.CreateLocalBooking();
        }

        public PartBooking CreateLocalPartBooking()
        {
            return ctrBooking.CreateLocalPartBooking();
        }

        #endregion

        #region Show services
        public ShowRoom GetShowRoomOnShowId(int show_Id)
        {
            return ctrShow.GetShowRoomOnShowId(show_Id);

        }


        public ShowType GetTypeOnShowId(int show_Id)
        {
            return ctrShow.GetTypeOnShowId(show_Id);
        }

        public List<Price> GetPrice(int show_Id)
        {
            return ctrShow.GetPrice(show_Id);
        }

        public Show GetShow(int show_Id)
        {
            return ctrShow.GetShow(show_Id);
        }

        public List<Show> GetShowsByDate(DateTime date)
        {
            return ctrShow.GetShowsByDate(date);
        }

        public List<Show> GetAllShows()
        {
            return ctrShow.GetAllShows();
        }

        #endregion

        #region Seat Services

        public Seat GetSeat(int seatId)
        {
            return ctrSeat.GetSeat(seatId);
        }

        public List<Seat> GetAllSeatsOnShow(Show show)
        {
            return ctrSeat.GetAllSeatsOnShow(show);
        }

        public int LockSeat(List<Seat> seats, int status)
        {
            return ctrSeat.LockSeat(seats, status);
        }

        public bool UnLockSeat(Seat seat)
        {
            return ctrSeat.UnLockSeat(seat);
        }

        #endregion
    }
}
